curl --request POST \
--url https://apigw.mka1.com/api/v1/llm/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "meetkai:functionary-urdu-mini-pak",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.7,
"max_tokens": 100
}
'{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1704067200,
"model": "meetkai:functionary-urdu-mini-pak",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 8,
"total_tokens": 23
}
}Deprecated: Use the Responses API (/api/v1/llm/responses) instead. OpenAI-compatible chat completion endpoint designed for use with the official OpenAI client libraries (Python, Node.js, etc.). Supports both streaming and non-streaming requests by setting the stream parameter. This endpoint handles the request/response directly and returns standard OpenAI-formatted responses. Use this when integrating with existing OpenAI client code. Note: The actual handler is registered at the Bun server level for optimal performance with the OpenAI SDK streaming format.
curl --request POST \
--url https://apigw.mka1.com/api/v1/llm/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "meetkai:functionary-urdu-mini-pak",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.7,
"max_tokens": 100
}
'{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1704067200,
"model": "meetkai:functionary-urdu-mini-pak",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 8,
"total_tokens": 23
}
}Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
Request parameters for creating a chat completion. Based on the OpenAI Chat Completions API.
ID of the model to use. You can use provider:model format or just the model name with a default provider.
1A list of messages comprising the conversation so far. At least one message is required.
1Show child attributes
A list of tools the model may call. Use this to provide function definitions the model can invoke.
Show child attributes
Controls which (if any) tool is called by the model. 'none' means the model will not call any tool. 'auto' means the model can pick. 'required' forces a tool call.
If set, partial message deltas will be sent as server-sent events. Note: This field is ignored by the streaming endpoint, used only by OpenAI-compatible client endpoints.
How many chat completion choices to generate for each input message. Default is 1.
1 <= x <= 9007199254740991The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.
1 <= x <= 9007199254740991What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
0 <= x <= 2An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
0 <= x <= 1Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
If specified, the system will make a best effort to sample deterministically. Determinism is not guaranteed, but the same seed should typically return similar results.
-9007199254740991 <= x <= 9007199254740991Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
An object specifying the format that the model must output. Setting to { 'type': 'json_object' } enables JSON mode.
Show child attributes
Whether to return log probabilities of the output tokens. If true, returns the log probabilities of each output token returned in the content of message.
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.
0 <= x <= 20A unique identifier representing your end-user, which can help monitor and detect abuse. Also used for usage tracking and analytics.
Options for streaming response. Only set this when you set stream: true.
Show child attributes
Whether to enable parallel function calling during tool use.
Constrains effort on reasoning for reasoning models. Lower effort results in faster responses and fewer reasoning tokens. Supported values: 'minimal', 'low', 'medium', 'high'.
minimal, low, medium, high Successful chat completion response. Returns JSON for non-streaming (stream=false) or Server-Sent Events for streaming (stream=true).
Represents a chat completion response from the API
A unique identifier for the chat completion
The object type, always 'chat.completion'
The Unix timestamp (in seconds) of when the chat completion was created
-9007199254740991 <= x <= 9007199254740991The model used for the chat completion
A list of chat completion choices. Can be more than one if n is greater than 1.
Show child attributes
Usage statistics for the completion request
Show child attributes
This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might impact determinism.
Was this page helpful?